export default {
    to(url) {
        wx.navigateTo({
            url,
            fail() {
                wx.showToast({
                    title: "跳转失败",
                    icon: "error"
                })
            }
        })
    },
    request(url,data={},method="GET"){
        Object.assign(data,{'hash':'b706835de79a2b4e80506f582af3676a'});
        //console.log(data);
        return new Promise((resolve,reject)=>{
            wx.request({
                url,
                data,
                method,
                success(res){
                    resolve(res)
                },
                fail(err){
                    reject(err);
                    wx.showToast({
                        icon:"error",
                        title:"数据请求出错"
                    })
                }
            })
        })
    }
}